//
//  ListViewController.m
//  Systetagram
//
//  Created by 欧杨 on 2021/1/7.
//

#import "ListViewController.h"
#import "UserTableViewCell.h"

static NSString *reuseIdentifier = @"cell";

@interface ListViewController ()

@end

@implementation ListViewController

- (instancetype)initWithList:(NSMutableArray *)list
{
    self = [super init];
    if (self) {
        self.userList = list;
        self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    }
    return self;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self.tableView registerClass:[UserTableViewCell class] forCellReuseIdentifier:reuseIdentifier];
}

#pragma mark -Datasource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.userList.count;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 100;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UserTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:reuseIdentifier];
    if (cell == nil) {
        cell = [[UserTableViewCell alloc] init];
        //[cell.follow addTarget:<#(nullable id)#> action:<#(nonnull SEL)#> forControlEvents:<#(UIControlEvents)#>];
    }
    cell.model = self.userList[indexPath.row];
    return cell;
}

@end
